package com.mzz.behavior.state.memento;

/**
 * 测试用例
 *
 * @author xushijian
 * @date 18/5/16
 */
public class Client {

    public static void main(String[] args) {

        UserInfo user = new UserInfo();
        Caretaker caretaker = new Caretaker();

        user.setAccount("meizhangzheng");
        user.setPassword("123456");
        user.setTelNo("13980402007");

        System.out.println("State 1");

        user.show();

        caretaker.setMemento(user.saveMemento());

        user.setPassword("111111");
        user.setTelNo("11111111111");
        System.out.println("state 2");

        user.show();

        //从备忘录中恢复
        user.restoreMemento(caretaker.getMemento());

        System.out.println("back to state 1");

        user.show();


    }
}
